import React, { useEffect } from "react";
import {
  Navigate,
  Outlet,
  redirect,
  useLocation,
  useNavigate,
} from "react-router-dom";
import LastLocationProvider from "./components/LastLocationRecorder";

function App() {
  const location = useLocation();
  const navigate = useNavigate();

  useEffect(() => {
    if (location.pathname === "/") {
      navigate("/table");
    }
  }, [location.pathname]);

  return (
    <LastLocationProvider>
      <Outlet />
    </LastLocationProvider>
  );
}

export default App;
